Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

annotate: add --fallback-dot-license option #823

Conversation

anthony-loiseau-act
Copy link
Contributor

reuse annotate defaults to fail when it reaches unrecognized files, and to ignore them when --skip-unrecognised option is given. When annotating a large set of files at once, creating a .license file for unrecognized files can be handy instead.

This PR creates a new --fallback-dot-license option for this case, making it easier to annotate a large repository with various file kinds.

This new option creates a .license file for any non-binary file whose extension is unknown to reuse. Known or binary files are handled as usual. Reminder: files detected as binary are automatically supported with a .license file.

This new option creates a .license file for any non-binary file
whose extension is unknown to reuse. Known or binary files are
handled as usual.

Reminder: files detected as binary are automatically supported
with a .license file.
Inject opened PR number into changelog entry.
Copy link
Member

@carmenbianca carmenbianca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @anthony-loiseau-act !

I love this feature proposal a lot. I just have one change I would make in moving some logic, and one improvement that should have been made anyway.

Are you happy to provide a new patch with the feedback? I'm also happy to follow up myself.

@@ -755,7 +767,7 @@ def run(args: Namespace, project: Project, out: IO[str] = sys.stdout) -> int:
force_multi=args.multi_line,
)
if not args.skip_unrecognised:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would remove a lot of logic elsewhere and change this to

Suggested change
if not args.skip_unrecognised:
if not args.skip_unrecognised or args.fallback_dot_license:

This reduces passing the parcel, and matches where skip_unrecognised is used.

Comment on lines +622 to +626
parser.add_argument(
"--fallback-dot-license",
action="store_true",
help=_("Write a .license file for unrecognised files"),
)
Copy link
Member

@carmenbianca carmenbianca Aug 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to use ArgumentParser.add_mutually_exclusive_group for --fallback-dot-license, --skip-unrecognised, and --force-dot-license?

Incidentally, 'Write' should be lower-case 'write'.

@anthony-loiseau-act
Copy link
Contributor Author

I would be pleased to give it a try if delay is not a big matter (since I am not very familiar with python and this code area). I think I can made it within a week max, depending on the time I take to more widely understand involved parts of the code.

@carmenbianca carmenbianca mentioned this pull request Oct 24, 2023
@carmenbianca
Copy link
Member

This is no longer needed with #851 merged. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants